//
//  ViewController.m
//  10509计算面积
//
//  Created by student on 16/2/21.
//  Copyright © 2016年 NIIT. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UITextField *length;
@property (weak, nonatomic) IBOutlet UITextField *width;
@property (weak, nonatomic) IBOutlet UITextField *rectangleArea;
@property (weak, nonatomic) IBOutlet UITextField *radius;
@property (weak, nonatomic) IBOutlet UITextField *clrcleArea;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)calculate:(id)sender
{
    float area = [self.length.text floatValue] * [self.width.text floatValue];
    self.rectangleArea.text = [NSString stringWithFormat:@"%.2f",area];
    
    float area2 = [self.radius.text floatValue] * [self.radius.text floatValue] * M_PI;
    self.clrcleArea.text = [NSString stringWithFormat:@"%.2f",area2];
}
- (IBAction)backgroundTag:(id)sender {
    [self.view endEditing:YES];
}

@end
